Consider a function of two variables, like this one \(g(x,y)\):
dom <- domain(x = c(-5, 5), y = c(-5, 5))
contour_plot(g(x,y) ~ x + y, dom)
interactive_plot(g(x,y) ~ x + y, dom)
Suppose you think of the function as describing the surface of a circus tent and you want to know how much volume is enclosed by the tent.
We’ve already considered the strategy of slices in calculating the volume of objects like pyramids and spheres. Let’s apply that to the volume-under-the-tent problem.
First, we’ll slice up the volume into slabs that run parallel to the \(y-z\) plane. Each of these slabs will be indexed according to its position on the \(x\) axis.
Second, for each slab indexed by \(x\), we’ll calculate the area of that slab in the \(y-z\) axis. This area can be found using the earlier method of integrating. Let’s take a look at a few slabs from \(x=-3\) to \(x=3\).
Finding the area of any of these slabs is easy, just find the anti-derivative with respect to \(y\) of \(g(x_{slab}, y)\). The helper() function in the following sandbox finds the area under the slab at location \(x\). (You can ignore the rest of the function and the use of sapply(). All this has to do with the way the R language will handle things when you ask for more than one slab at a time.)
slab_area <- function(x) {
helper <- function(x) {
F <- antiD(g(x, y) ~ y, x=x)
F(5) - F(-5)
}
sapply(x, helper)
}
slab_area(x=2)
## [1] -22.11813
slab_area(x=4)
## [1] 17.43843
To find the total volume under the tent integrate the slab area over the extent of \(x\):
slab_area <- function(x) {
helper <- function(x) {
F <- antiD(g(x, y) ~ y, x=x)
F(5) - F(-5)
}
sapply(x, helper)
}
slab_antid <- antiD(slab_area(x) ~ x)
slab_antid(x = 5) - slab_antid(x = -5)
## [1] -40.92934
At the heart of the computer notation is the use of antiD() on a function that is itself defined in terms of antiD(). In other words, a kind of antiD(antiD(...)). The math notation is prettier: \[\int_{-5}^5 \int_{-5}^5 g(x, y) dy dx\] which can be seen as shorthand for \[\int_{-5}^5 \left\{\int_{-5}^5 g(x, y) dy\right\} dx = \int_{-5}^{5} \mbox{slab_area}(x) dx\] The integral within an integral is called an “iterated integral” or, in the case here, a “double integral.”
Working with double integrals (which you will see in more advanced math, science, and engineering courses) requires that you pay close attention to the “what” of the interior integrals. For instance: \[\int_{-5}^{5} g(x, y) dy\] might appear at first glance to evaluate to a number, since it is a definite integral. But the integration \(\int dy\) sums over the \(y\) variable and leaves the \(x\) variable alone. So \(\int_{-5}^{5} g(x, y) dy\) is a function of \(x\), not a number.
Question tmp-1: Modify the original double integral to calculate the signed volume under the tent lifted vertically by 2 meters.
-141 [Oops! You lowered the tent by 1 meter.]
-41 [That’s the volume before the 2 meter lift.]
59 []
159 ((\(\surd\)) ) []
259 []
Question tmp-2: “Areas” and “volumes” of a function \(g(x,y)\) calculated by integration are really signed areas and volumes. But a simple change in the function being integrated will give you the unsigned areas and volumes (that is, areas and volumes in the everyday sense). What’s the unsigned volume of the tent lifted by 2 meters?
235 []
346 ((\(\surd\)) ) []
457 []
568 []